package org.example.order.controller;

import org.example.order.model.OrderTbl;
import org.example.order.service.OrderTblService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class OrderTblController {

    @Autowired
    private OrderTblService orderTblService;

    //测试请求
    @GetMapping("/orderTest")
    public String orderTest() {
        List<OrderTbl> list = orderTblService.list();
        return "order中一共有：" + list.size() + "数据";
    }

    @GetMapping("/create")
    public String create(@RequestParam Integer accountId, @RequestParam String commodityCode, @RequestParam int count) {
        orderTblService.create(accountId, commodityCode, count);
        return "更新成功";
    }
}